<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var ary = [{
      id: 1,
      name: '张三'
    }, {
      id: 2,
      name: '李四'
    }]
    var target = ary.find(item => {
      return item.id === 1
    })
    console.log(target);  //{id: 1, name: "张三"}

    var target2 = ary.find(item => {
      return item.id === 3
    })
    console.log(target2);  //undefined
  </script>
</body>

</html>